package cn.itsource.system.service.impl;


import cn.itsource.basic.util.PageResult;
import cn.itsource.system.domain.OperationLogs;

import cn.itsource.system.query.OperationLogsQuery;

import cn.itsource.system.service.OperationLogsService;
import cn.itsource.system.mapper.OperationLogsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 26871
* @description 针对表【operation_logs】的数据库操作Service实现
* @createDate 2024-05-06 06:49:48
*/
@Service
public class OperationLogsServiceImpl implements OperationLogsService{
    @Autowired
    private OperationLogsMapper operationLogsMapper;

    @Override
    public void insert(OperationLogs operationLogs) {
        operationLogsMapper.insert(operationLogs);

    }

    @Override
    public void delete(Long id) {
        operationLogsMapper.delete(id);

    }

    @Override
    public void update(OperationLogs operationLogs) {
        operationLogsMapper.update(operationLogs);

    }

    @Override
    public OperationLogs selectById(Long id) {

        return operationLogsMapper.selectById(id);
    }

    @Override
    public void save(OperationLogs operationLogs) {
        if (operationLogs.getId() == null){
            operationLogsMapper.insert(operationLogs);
        }else {
            operationLogsMapper.update(operationLogs);
        }

    }

    @Override
    public void patchDelete(List<Long> ids) {
        operationLogsMapper.patchDelete(ids);

    }

    @Override
    public List<OperationLogs> selectAll() {

        return operationLogsMapper.selectAll();
    }

    @Override
    public PageResult<OperationLogs> selectByQueryPage(OperationLogsQuery operationLogsQuery) {
        Integer total = operationLogsMapper.selectCount(operationLogsQuery);
        List<OperationLogs> list = operationLogsMapper.selectByQueryPage(operationLogsQuery);
        System.out.println(list);
        return new PageResult<OperationLogs>(total,list);
    }

}
